package com.pinxixi.pay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016102700768706";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDNgsnayWywn1um6WTh1mHQImxWwW0B0WK5VAEqKe0RLVVbuiaIWlMzg8Lnhw9vEMRqdwAuDqH5AjFN7FuAmSc4ihYVEYjNRNMagbnuQiK8kXZm1mj17aLB4ZnS5guLRn4jMRRul55S3iYq2gvIgIMYk9I1sTtw1jyFAmfXhFK3qbSd0lDH/mZbWBB0dwbFrsw6pQBgnxg7eTKSGyOOp7pLMG7Ot3Q5bFHnz0CGvpTXFAVMICLaWEQBCg5IwgfzjZvE60vj396n2wywJ2AZu6ZjJQrY0F7pe/BSEe4wKR5nAjWVNyh1MLizQ/KVjK+LgC7wYIZYhCosq+jleI/aicgRAgMBAAECggEAMKOu0KhxoA/naka9CLJrrg4npBTdjtuWyRQ3vlnz8OfQ1wfkzMrL/FpIC/IsVfYa9rO5iC0QatX5A19YfMRCwx/zgAMJZMPQTuq7LcfbXtPyuP4wE1yt88NIW+D0hH8npX6dPluGLkjDscqvlUHNRUjfLLQIxHkAE97w4tI/nZYRQ4ajcpx6uAUA7NXvEGleAYoI08DhWHbRfK6692F+PAlPOE+tyxoEaIbiLzUMBw+3rdQWsCVhOfzQIv/aig/IgABg42FO2yycNizvLIndC7CMyGZXTR5o+W+QCRDFZrL0vxCElTV4R4e5dN7aJA0HB8Aa9U0OyBXM3f58RkYakQKBgQDoELKnf5AiRpiCoX2C4jTSLkjz3aGDwYSm2vqPc238l5veIiNHAHH6NKuzUM1wt9OmBx/vJpuy9zZPBIOUYXu3T9lam9aj3l+JWn4we6nnnuQpcTw3uh3pkaBdds9CA03zdvDokNmEu57cYUCuSU7kdw1qezEVpX9iJV++lCSF7QKBgQDitPeKGhqh8y7PqbMPOstR88ziLm0/Spn0LhZmrzJSBJduw4nCuSNIGBdxL0lvlBcl/X2xaZCLCo18XFtoZgOoBY0/sqa+b0+niEcLg7YNsrdGfrdDTQwH6NqkI6z4LNZqQbR9B2DuuzjeFFbZHxW6Kbi7OXfqq6ObRM2aOGCGNQKBgQC3cpO34xgucD4Zbc2JDIaS6/HRjY8jV3QkbpCJm8cDWVnmxHe8pfZzwvVEQAjXJQoTgihVZeDJHbF5z2iwgEtLQrzgarbHPX+qVbXRX8CVD77vn8rphqAkxnDN0aDPX0tcvdZ9EhxRV/uh3ONDo0HRSud5GD9aDEThcgf44KTqlQKBgHyeT4gZi1REshGyzdvsTMFyy8f1D1aAMpqYDvZJDdcp8PgRApQIYw2JOLGd9bcg54yZiFNSnQLhPR8EQbbkhNQCoT9HfAMoetezwKHit9tVxws4MpMLMjbS2ATsG3Ocagykq4si2DTCs6LX+VmGjdH0hzhbgcB8swVxz7cbkGuVAoGAKHiWOAqHIjKhfZBFW+GgDm2XOfrI1VyN3Fl+6bDv2/0M5YDXeK6HupR6M2sACz0ROxxuAe4NRiDnAPUTgxitNQs12naXIZXCKIUfMRXsDUTGxmkECPjpu/q0u4yW5vj2FAw6nKkium4Atp0duKFmVZYBmP35zzpdIJZx2T2cLiE=";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAomgCML2UkzcGN6IZCQpOVLpEWK9Xgr12SBX13Ky4cKNwxuDjsxCn2dT1Im5ab72P/MbL63fJGoV1gcVy6pNWyKrf1iw1F0r5TTPIcZ2WnKc0yS/NW387iYKYZg/wF09qOs1e5SXbimFedsaIZ/Uu4QLpI58JklWAo/dGep5kzCb/eHIommIoOZVTtmMhs9GxJhThCyBkuegjPc98gAgk2hBOOVdzpCkic1qXJ1p4kA55Zdg0S584MvmIr2kOMwsxoJAHn1U/TjFL8LwM0htIK+DCdpOWW+V436LrEhqx5SbFuXyLjnfh3uNKEg/eUY9YTyDlHldxDh47Vu/d4faCAwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:9112/notifyAlipay";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost:10000/paysuccess.html";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}